//
//  ViewController.swift
//  swiftForLearn
//
//  Created by  Mac on 2017/8/18.
//  Copyright © 2017年  Mac. All rights reserved.
//

import UIKit

class ViewController: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        //        简单数据类型
        //        简单数据类型
        let personName : String = "hello world"  //常量用let
        var personAge : String = "world"         //变量用var
        
        personAge = "word l"
        
        print(personAge)
        print(personName)
        
        let pi = 3.1415926
        let newDateFor = 1
        
        print(pi)
        print("pi的值是:\(pi)")
        
        //        输出字符串的时候 将常量和变量放入\()中
        
        print(newDateFor)
        
        print("数据类型强转")
        
        let testInt = Int(pi)
        
        print(testInt)
        print("\(testInt)")
        
        let testDouble = Double(pi)
        print("\(testDouble)")
        
        //        布尔值
        
        let tValue  = true
        
        let fValue  = false
        
        let tValue2 : Bool = true
        
        let i = 1
        
        
        if tValue
        {
            print("2")
        }
        
        
        if !fValue {
            print("3")
        }
        if tValue2 {
            print("5")
        }
        
        
        if i == 1 {
            print("4")
        }
        
        //      元组
        
        let http404Error = (404,"Not Found")
        let (code, message) = http404Error
        print("code:\(code),message:\(message)")
        let(_,ErrorMessage) = http404Error
        print(http404Error.1)
        let ErrorCode = (requestError:401,402,403)
        print(ErrorCode)
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    
}

